using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.DirectX;

namespace AlumnoEjemplos.TP3D.Collider
{
    /*
     * Dos superficies estan en colision si existe una interseccion.
     */
    public abstract class CollisionSurface : Placeable
    {
        protected Placeable surrounded;

        public CollisionSurface()
        {
        }

        public CollisionSurface(Placeable placeable)
        {
            this.Surrounded = placeable;
        }

        public virtual Placeable Surrounded
        {
            set
            {
                this.surrounded = value;
            }
            get
            {
                return this.surrounded;
            }
        }
        
        public Vector3 Position
        {
            get { return this.Surrounded.Position; }
        }

        public abstract Boolean Contain(Vector3 position);
        public abstract Boolean Intersect(CollisionSurface surface);

        public Boolean Collides(CollisionSurface aSurface)
        {
            return this.Contain(this.Position) || this.Intersect(aSurface);
        }
    }
}
